// import { Row } from 'antd';
// import { FC, ReactNode } from 'react';
//
// interface PagePanelProps {
//   isSearch?: boolean;
//   title?: ReactNode;
// }
//
// const PagePanel: FC<PagePanelProps> = ({ children, title, isSearch }) => {
//   return (
//     <Row className={isSearch ? 'search__form' : 'normal__form'}>
//       <Row className="panel__wrap">
//         {title ? <Row className="panel__title">{title}</Row> : null}
//         <Row className="panel__list">{children}</Row>
//       </Row>
//     </Row>
//   );
// };
//
// export default PagePanel;

import { Row } from 'antd';
import classnames from 'classnames';
import ConstantModel from '@/utils/constantModel';
import PageTitle from '../page-title';
interface FormWrapProps {
  title?: any; //(fuction or string)
  children: any;
  type?: string;
  rightCbk?: () => any;
}
const FormWrap = (props: FormWrapProps) => {
  const titleType = typeof props.title;
  const pageTitleProps: any = {
    label: props.title,
  };
  if (props.rightCbk) {
    pageTitleProps.rightCbk = props.rightCbk;
  }
  return props.children ? (
    <Row
      className={classnames(
        props.type && props.type == ConstantModel.TYPE.SEARCH ? 'search__form' : 'normal__form',
      )}
    >
      <Row className="panel__wrap">
        {props.title ? (
          <Row className="panel__title">
            {titleType === 'string' ? <PageTitle {...pageTitleProps} /> : props.title()}
          </Row>
        ) : null}
        <Row className="panel__list">{props.children}</Row>
      </Row>
    </Row>
  ) : null;
};

export default FormWrap;
